from sqlalchemy import Column, String, Double, DateTime, ForeignKey
from sqlalchemy.dialects.postgresql import UUID
from app.db.base_class import Base
from app.models.archivable import Archivable

# 数据库模型类
class ModelTraining(Base, Archivable):
    # 模型版本
    model_version = Column(String, nullable=True, comment="模型版本")
    # 训练文本
    training_text = Column(String, nullable=True, comment="训练文本")
    # 训练语音
    training_voiceprint = Column(String, nullable=True, comment="训练语音")
    # 文本准确度
    text_accuracy = Column(Double, nullable=True, comment="文本准确度")
    # 句子准确度
    sentence_accuracy = Column(Double, nullable=True, comment="句子准确度")
    # 核心词准确度
    core_word_accuracy = Column(Double, nullable=True, comment="核心词准确度")
    # 长文本准确度
    long_text_accuracy = Column(Double, nullable=True, comment="长文本准确度")
    # 实时 WER（词错误率）
    realtime_wer = Column(Double, nullable=True, comment="实时WER(词错误率)")
    # 识别文本
    recognize_text = Column(String, nullable=True, comment="识别文本")
    # 综合准确度
    comprehensive_accuracy = Column(Double, nullable=True, comment="综合准确度")
    # 上传文件路径
    upload_file_path = Column(String, nullable=True, comment="训练素材上传路径")
    # 用户id
    user_id = Column(UUID(as_uuid=True), ForeignKey("user.id"))
